package com.ruoyi.electronicFence.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.electronicFence.domain.TEquipmentMonitorDevice;
import com.ruoyi.electronicFence.service.ITEquipmentMonitorDeviceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * equipmentMonitorDeviceController
 *
 * @author sxygsj
 * @date 2024-08-07
 */
@RestController
@RequestMapping("/electronicFence/equipmentMonitorDevice")
public class TEquipmentMonitorDeviceController extends BaseController
{
    @Autowired
    private ITEquipmentMonitorDeviceService tEquipmentMonitorDeviceService;

    /**
     * 查询equipmentMonitorDevice列表
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:equipmentMonitorDevice:list')")
    @GetMapping("/list")
    public TableDataInfo list(TEquipmentMonitorDevice tEquipmentMonitorDevice)
    {
        startPage();
        List<TEquipmentMonitorDevice> list = tEquipmentMonitorDeviceService.selectTEquipmentMonitorDeviceList(tEquipmentMonitorDevice);
        return getDataTable(list);
    }

    /**
     * 导出equipmentMonitorDevice列表
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:equipmentMonitorDevice:export')")
    @Log(title = "equipmentMonitorDevice", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TEquipmentMonitorDevice tEquipmentMonitorDevice)
    {
        List<TEquipmentMonitorDevice> list = tEquipmentMonitorDeviceService.selectTEquipmentMonitorDeviceList(tEquipmentMonitorDevice);
        ExcelUtil<TEquipmentMonitorDevice> util = new ExcelUtil<TEquipmentMonitorDevice>(TEquipmentMonitorDevice.class);
        util.exportExcel(response, list, "equipmentMonitorDevice数据");
    }

    /**
     * 获取equipmentMonitorDevice详细信息
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:equipmentMonitorDevice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tEquipmentMonitorDeviceService.selectTEquipmentMonitorDeviceById(id));
    }

    /**
     * 新增equipmentMonitorDevice
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:equipmentMonitorDevice:add')")
    @Log(title = "equipmentMonitorDevice", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TEquipmentMonitorDevice tEquipmentMonitorDevice)
    {
        return toAjax(tEquipmentMonitorDeviceService.insertTEquipmentMonitorDevice(tEquipmentMonitorDevice));
    }

    /**
     * 修改equipmentMonitorDevice
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:equipmentMonitorDevice:edit')")
    @Log(title = "equipmentMonitorDevice", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TEquipmentMonitorDevice tEquipmentMonitorDevice)
    {
        return toAjax(tEquipmentMonitorDeviceService.updateTEquipmentMonitorDevice(tEquipmentMonitorDevice));
    }

    /**
     * 删除equipmentMonitorDevice
     */
    //@PreAuthorize("@ss.hasPermi('electronicFence:equipmentMonitorDevice:remove')")
    @Log(title = "equipmentMonitorDevice", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tEquipmentMonitorDeviceService.deleteTEquipmentMonitorDeviceByIds(ids));
    }
}
